package org.dizem.IntelliPainter.algorithm.graphictransform;

import org.dizem.IntelliPainter.graphics.*;
import org.dizem.IntelliPainter.graphics.Point;
import org.dizem.IntelliPainter.graphics.Polygon;

import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: dizem
 * Date: 2010-10-19
 * Time: 21:31:35
 */
public class GraphicMoving {
	public static void transform(Polygon g, Point base, Point direction) {
		if(base == null || direction == null)
			throw new NullPointerException("Point should not be null");
		int x = direction.x - base.x;
		int y = direction.y - base.y;
		for(int i=0; i<g.points.size(); ++i) {
			g.points.get(i).x += x;
			g.points.get(i).y += y;
		}
	}
}
